<?php
/**
 * @author Radovan Dvorsky
 * @version 20100403
 */
require_once ('Zend/Validate/Abstract.php');

class My_Validate_GreaterThan extends Zend_Validate_Abstract {
	
	const NOT_GREATER = 'notGreater';
	
	/**
     * @var array
     */
    protected $_messageTemplates = array(
        self::NOT_GREATER => "'%value%' is not greater than '%min%'",        
    );
    
    /**
     * Additional variables available for validation failure messages
     *
     * @var array
     */
    protected $_messageVariables = array(
    	'min' => '_min'      
    );   
	
    /**
     * 
     * @var int
     */
    protected $_min;
	
    
    
	function __construct($min) {
		$this->setMin($min);
	}    
    
	/**
	 * @return the $_min
	 */
	public function getMin() {
		return $this->_min;
	}

	/**
	 * @param $_min the $_min to set
	 */
	public function setMin($min) {
		$this->_min = $min;
	}	
	
	/**
	 * Vrati true ak je hodnota <code>$value</code> vacsia ako <code>$min</code>,
	 * inak vrati false
	 * 
	 * @param int $value
	 */
	public function isValid($value) {
		
		$this->_setValue($value);
		
		if( $value <= $this->_min ){
			$this->_error(self::NOT_GREATER);
			return false;
		}
		
		return true;
	}
}

?>